<template>
	<view class="home">
		<view class="">
			<view class="">
				<image src="../../static/images/bg.png" mode="" class="home_bg"></image>
			</view>
			<view class="userInfo">
				<view class="">
					<image :src="user.index_avatar" mode="" class="userInfo_img"></image>
				</view>
				<view class="userInfo_name">{{user.index_name}}</view>
			</view>
			<view class="userInfo_text">简介：{{user.index_text ? user.index_text :'暂无简介'}}</view>
			
		</view>
		<view class="userInfo_view">
			<view class="userInfo_edit" @click="bindtapDetail">编辑资料 <image src="../../static/images/arrow02.png" style="width: 40rpx;height: 40rpx;margin-left: 10rpx;"></image></view>
			<!-- <view class="userInfo_edit1">加关注 <image src="../../static/images/add.png" style="width: 40rpx;height: 40rpx;margin-left: 10rpx;"></image></view> -->
		</view>
		<view class="list">
			<view class="list_meun" @click="tabPage(0)">
				<view class="list_num">{{wechat.gz_count}}</view>
				<view class="list_name">我关注的</view>
			</view>
			<view class="list_meun" >
				<view class="list_num">{{wechat.tp_count}}</view>
				<view class="list_name">发起投票</view>
			</view>
			<view class="list_meun" @click="tabPage(1)">
				<view class="list_num">{{wechat.fs_count}}</view>
				<view class="list_name">粉丝数</view>
			</view>
		</view>
		<view class="model">
			<view class="model_title">推荐投票</view>
		</view>
	</view>
</template>

<script>
	import {userIndexAPI} from '@/api/user'
	export default {
		data() {
			return {
				user:{},
				wechat:{},
			}
		},
		mounted() {
			
		},
		onShow() {
			this.getInfo()
		},
		methods:{
			getInfo(){
				var parems = {
					token:uni.getStorageSync('accessToken'),
					id:uni.getStorageSync('userInfo').id
				}
				userIndexAPI(parems).then(res =>{
					if(res.code == 1){
						this.user = res.data.user
						this.wechat= res.data
					}else{
						wx.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			},
			// 列表
			tabPage(data){
				uni.navigateTo({
					url:'./focusList?type=' + data
				})
			},
			bindtapDetail(){
				uni.navigateTo({
					url:'./userInfo'
				})
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.home_bg{
		width: 100%;
		height: 300rpx;
	}
	.userInfo{
		position: relative;
		top: -7vw;
		padding: 0 30rpx;
		display: flex;
		align-items: center;
	}
	.userInfo_text{
		font-size: 28rpx;
		color: #909193;
		padding: 0 30rpx;
		margin-top: -5vw;
	}
	.userInfo_img{
		width: 150rpx;
		height: 150rpx;
		border-radius: 20rpx;
		background: #c0c4cc;
	}
	.userInfo_name{
		font-size: 34rpx;
		color: #303133;
		font-weight: bold;
		margin-top: 80rpx;
		margin-left: 30rpx;
		letter-spacing: 2rpx;
	}
	.userInfo_view{
		display: flex;
		align-items: center;
	}
	.userInfo_edit{
		margin: 15rpx 30rpx;
		width: 200rpx;
		height: 60rpx;
		background: #f6f6f6;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 100rpx;
	}
	.userInfo_edit1{
		margin: 15rpx 30rpx;
		width: 175rpx;
		height: 60rpx;
		background: #3c9cff;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 100rpx;
		color: #fff;
	}
	.list{
		display: flex;
		align-items: center;
		width: 100%;
		padding: 0 30rpx;
		.list_meun{
			width: 140rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
		}
		.list_num{
			font-size: 28rpx;
			color: #333333;
			font-weight: bold;
		}
		.list_name{
			font-size: 26rpx;
			color: #9A9A9A;
			margin-top: 10rpx;
		}
	}
	.model{
		padding: 0 30rpx;
		margin-top: 15rpx;
	}
	.model_title{
		font-size: 28rpx;
		color: #303133;
		font-weight: bold;
		border-bottom: 2rpx solid #eee;
		height: 100rpx;
		display: flex;
		align-items: center;
	}
</style>